home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 008a / emslb221.zip / EMSTEST.H < prev    next >
C/C++ Source or Header  |  1991-09-23  |  5KB  |  156 lines

  1. /***************************************************************************
  2. *   emstest.h                                                              *
  3. *   HEADER FOR tester for EMSLIB                                           *
  4. *   OS:      DOS                                                           *
  5. *   VERSION: 1.0                                                           *
  6. *   DATE:    09/23/91                                                      *
  7. *                                                                          *
  8. *   Copyright (c) 1991 James W. Birdsall. All Rights Reserved.             *
  9. *                                                                          *
  10. *   Compiles under Borland C++ 2.0 and MSC 6.00A.                          *
  11. *                                                                          *
  12. *   Header file for EMSTEST.                                               *
  13. *                                                                          *
  14. ***************************************************************************/
  15.  
  16. #ifndef EMSLIB_H
  17.     **** ERROR **** MUST INCLUDE EMSLIB.H BEFORE EMSTEST.H
  18. #endif
  19.  
  20. #ifndef EMSTEST_H
  21. #define EMSTEST_H
  22.  
  23. /*
  24. ** system includes <>
  25. */
  26.  
  27. /*
  28. ** custom includes ""
  29. */
  30.  
  31. /*
  32. ** local #defines
  33. */
  34.  
  35. /*
  36. ** define ASM to be the appropriate keyword for in-line assembly according
  37. ** to the compiler.
  38. */
  39. #ifdef __TURBOC__
  40. #define ASM              asm
  41. #else
  42. #define ASM              _asm
  43. #endif
  44.  
  45. /* MSC does not have a MK_FP() macro. Define it if it doesn't exist. */
  46. #ifndef MK_FP
  47. #define MK_FP(seg,off)   (void far *)((((long)(seg)) << 16) | ((long)(off)))
  48. #endif
  49.  
  50. /* at least 8 EMS pages must be free for all tests to be performed */
  51. #define MINFREE          8L
  52.  
  53. /* header and trailer messages for each test */
  54. #define TESTHEADER()     printf(">>>TEST #%d: %s\n", testno++, gblmsg)
  55. #define TESTTAILER()     printf("Test passed.\n")
  56.  
  57. /*
  58. ** This macro is for return checking for functions which are expected
  59. ** to succeed. It makes function calls to check if
  60. **      1) the function returned EMMOOPS
  61. **      2) the function returned a value that isn't EMMOOPS or 0
  62. **      3) the function set _EMMerror to an unexpected value
  63. ** The parameters are:
  64. **      fu  - char *, name of the function
  65. **      st  - status value returned by the function
  66. **      ex  - expected value of _EMMerror
  67. **      fr1 - conventional memory pointer to be freed on emergency exit
  68. **      fr2 - EMS handle to be freed on emergency exit
  69. **      fr3 - another EMS handle to be freed on emergency exit
  70. */
  71. #define TRIPLECHECK(fu, st, ex, fr1, fr2, fr3) \
  72.                          failcheck((fu), (st), (fr1), (fr2), (fr3)); \
  73.                          weirdretchk((fu), (st), (fr1), (fr2), (fr3)); \
  74.                          weirdcodechk((fu), (ex), (fr1), (fr2), (fr3))
  75.  
  76. /*
  77. ** Define FMEMCMP and FMEMSET according to whether library functions
  78. ** are present or not.
  79. */
  80. #ifndef NO_FFUNC
  81.  
  82. #define FMEMCMP          _fmemcmp
  83. #define FMEMSET          _fmemset
  84.  
  85. #else
  86.  
  87. #define FMEMCMP          Fmemcmp
  88. #define FMEMSET          Fmemset
  89.  
  90. #endif
  91.  
  92.  
  93. /*
  94. ** misc: copyright strings, version macros, etc.
  95. */
  96.  
  97. /*
  98. ** typedefs
  99. */
  100.  
  101. /*
  102. ** global variables
  103. */
  104.  
  105. /*
  106. ** static globals
  107. */
  108.  
  109. /*
  110. ** function prototypes
  111. */
  112.  
  113. extern void do_alloc_tests(unsigned long bytes);
  114. extern void do_palloc_tests(int pages);
  115. extern void do_frame_tests(void);
  116. extern void do_name_tests(void);
  117. extern void do_map_tests(void);
  118. extern void do_sr_tests(void);
  119. extern void do_shortcopy_tests(void);
  120. extern void do_longcopy_tests(void);
  121.  
  122. extern unsigned long test_EMMcoreleft(void);
  123. extern int test_EMMalloc(unsigned long bytes);
  124. extern int test_EMMallocpages(int pages);
  125. extern void test_EMMfree(int handle);
  126. extern void test_EMMmappage(int frameno, int handle, int logpage);
  127.  
  128. extern void weirdretchk(char *function, int status, void *tofree1, int tofree2,
  129.                                                                   int tofree3);
  130. extern void weirdcodechk(char *function, int expected, void *tofree1,
  131.                                                      int tofree2, int tofree3);
  132. extern void failcheck(char *function, int status, void *tofree1, int tofree2,
  133.                                                                   int tofree3);
  134. extern void nofailcheck(char *function, int status, void *tofree1, int tofree2,
  135.                                                                   int tofree3);
  136.  
  137. extern int farmemcheck(unsigned char far *buffer, unsigned int len,
  138.                                                       unsigned char checkchar);
  139. extern void farincwordfill(unsigned char far *buffer, unsigned int len);
  140. extern int farincwordcheck(unsigned char far *buffer, unsigned int len);
  141. extern void farinclongfill(unsigned char far *buffer, unsigned long len,
  142.                                                           unsigned long start);
  143. extern int farinclongcheck(unsigned char far *buffer, unsigned long len,
  144.                                                           unsigned long start);
  145. extern unsigned long get_tick(void);
  146.  
  147. #ifdef NO_FFUNC
  148.  
  149. extern int Fmemcmp(void far *buf1, void far *buf2, unsigned int n);
  150. extern void Fmemset(void far *s, int c, unsigned int n);
  151.  
  152. #endif
  153.  
  154. #endif
  155.  
  156.